package com.my.demo.demo2.config;

import sun.net.spi.DefaultProxySelector;

import java.net.Proxy;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;

public class MultiProxySelector extends DefaultProxySelector {

    int count;

    public MultiProxySelector(int count){
        this.count = count;
    }

    @Override
    public List<Proxy> select(URI uri) {
        List<Proxy> list = new ArrayList<>(count);
        List<Proxy> select = super.select(uri);
        for (int i=0;i<count;i++){
            list.addAll(select);
        }
        return list;
    }

}
